package com.ruoyi.system.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.LabProjectTeachingCultivation;
import com.ruoyi.system.service.ILabProjectTeachingCultivationService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 项目创建虚拟教学培育Controller
 * 
 * @author jun.wang
 * @date 2022-04-13
 */
@RestController
@RequestMapping("/system/cultivation")
public class LabProjectTeachingCultivationController extends BaseController
{
    @Autowired
    private ILabProjectTeachingCultivationService labProjectTeachingCultivationService;

    /**
     * 查询项目创建虚拟教学培育列表
     */
    // @PreAuthorize("@ss.hasPermi('system:cultivation:list')")
    @GetMapping("/list")
    public TableDataInfo list(LabProjectTeachingCultivation labProjectTeachingCultivation)
    {
        startPage();
        List<LabProjectTeachingCultivation> list = labProjectTeachingCultivationService.selectLabProjectTeachingCultivationList(labProjectTeachingCultivation);
        return getDataTable(list);
    }

    /**
     * 导出项目创建虚拟教学培育列表
     */
    // @PreAuthorize("@ss.hasPermi('system:cultivation:export')")
    @Log(title = "项目创建虚拟教学培育", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(LabProjectTeachingCultivation labProjectTeachingCultivation)
    {
        List<LabProjectTeachingCultivation> list = labProjectTeachingCultivationService.selectLabProjectTeachingCultivationList(labProjectTeachingCultivation);
        ExcelUtil<LabProjectTeachingCultivation> util = new ExcelUtil<LabProjectTeachingCultivation>(LabProjectTeachingCultivation.class);
        return util.exportExcel(list, "cultivation");
    }

    /**
     * 获取项目创建虚拟教学培育详细信息
     */
    // @PreAuthorize("@ss.hasPermi('system:cultivation:query')")
    @GetMapping(value = "/{instanceId}")
    public AjaxResult getInfo(@PathVariable("instanceId") Long instanceId)
    {
        return AjaxResult.success(labProjectTeachingCultivationService.selectLabProjectTeachingCultivationById(instanceId));
    }

    /**
     * 新增项目创建虚拟教学培育
     */
    // @PreAuthorize("@ss.hasPermi('system:cultivation:add')")
    @Log(title = "项目创建虚拟教学培育", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LabProjectTeachingCultivation labProjectTeachingCultivation)
    {
        return toAjax(labProjectTeachingCultivationService.insertLabProjectTeachingCultivation(labProjectTeachingCultivation));
    }

    /**
     * 修改项目创建虚拟教学培育
     */
    // @PreAuthorize("@ss.hasPermi('system:cultivation:edit')")
    @Log(title = "项目创建虚拟教学培育", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LabProjectTeachingCultivation labProjectTeachingCultivation)
    {
        return toAjax(labProjectTeachingCultivationService.updateLabProjectTeachingCultivation(labProjectTeachingCultivation));
    }

    /**
     * 删除项目创建虚拟教学培育
     */
    // @PreAuthorize("@ss.hasPermi('system:cultivation:remove')")
    @Log(title = "项目创建虚拟教学培育", businessType = BusinessType.DELETE)
	@DeleteMapping("/{instanceIds}")
    public AjaxResult remove(@PathVariable Long[] instanceIds)
    {
        return toAjax(labProjectTeachingCultivationService.deleteLabProjectTeachingCultivationByIds(instanceIds));
    }
}
